exports.login = function(req,res){

  //获取参数信息
  var bodyParams = req.routeInfo.bodyParams;

  //最终结果
  var resultData = {};

  //判断帐号是否存在
  function searchUserInfo(cb){

      R.SEND_HTTP(
          req,
          res,
          {
              url: CORE_APIConfig.coreAPI.userSearch.Request_Api_Url + "/u_username/" + bodyParams.username + "/u_is_activation/1",
              method : 'POST',
              data   : {
                  
              }
          },
          function (data) {

              //判断用户是否存在
              if(data.result.data.length <= 0){
                  return RES.errorResponse(res,"您的帐号或密码有误！请核查清楚在进行登录。");
              }

              //判断密码是否正确
              if(data.result.data[0].u_password != bodyParams.password){
                  return RES.errorResponse(res,"您的帐号或密码有误！请核查清楚在进行登录。");
              }

              resultData.u_id          = data.result.data[0].u_id;
              resultData.u_type        = data.result.data[0].u_type;
              resultData.u_master_osid = data.result.data[0].u_master_osid;
              resultData.u_nickname    = data.result.data[0].u_nickname;
              resultData.u_is_manager  = data.result.data[0].u_is_manager;
              resultData.u_leader  = data.result.data[0].u_leader;

              cb();
              
          }
      )
  }

  //获取节点ID的名称（代理商或战略名称）
  function searchOrgaizationInfo(cb){

      R.SEND_HTTP(
          req,
          res,
          {
              url: CORE_APIConfig.coreAPI.organizationStructureExtensionInfoSearch.Request_Api_Url + "/os_id/" + resultData.u_master_osid,
              method : 'POST',
              data   : {
                  fields : "os_name"
              }
          },
          function (data) {

              resultData.u_master_name = data.result.data[0].os_name;

              cb();
              
          }
      )

      

  }

  F.Serial([searchUserInfo,searchOrgaizationInfo],() => {
      RES.successResponse(res,resultData);
  })

}